<include file="Tpl/Public/admin_top.html">
<form action="__APP__/admin{url}purviewUpdate2{shtml}" method="post">
	<table width=98% height="auto" cellspacing=0 cellpadding=0 border=1 style="margin:auto;border:1px solid #ccc">
		<tr>
			<td height="40" colspan="5" style="line-height:40px;background:url('{site}/Public/images/topbg.jpg')"><span style="font-size:16px;text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.6);color:#333;font-weight:bold;">用户组 [ {arr->name} ] 的权限</span></td>
		</tr>
		<tr>
			<td height="30" style="line-height:30px;font-size:15px;color:#222;font-weight:bold;"><input type="checkbox" onchange="selectAll()">版块名称</td>
			<td height="30" style="line-height:30px;font-size:15px;color:#222;font-weight:bold;">浏览</td>
			<td height="30" style="line-height:30px;font-size:15px;color:#222;font-weight:bold;">发帖</td>
			<td height="30" style="line-height:30px;font-size:15px;color:#222;font-weight:bold;">回帖</td>
			<td height="30" style="line-height:30px;font-size:15px;color:#222;font-weight:bold;">点评</td>
		</tr>
<?php
 if(!empty($this->array_two['list'])){
 	foreach($this->array_two['list'] as $vo){
?>
			<tr onmouseover="addClass(this)" onmouseout="removeClass(this)">	
				<td height="30" style="line-height:30px;font-size:12px;color:#555;">&nbsp;<?php echo $vo['szone']; ?></td>
				<td height="30" style="line-height:30px;font-size:12px;color:#555;"><input type="checkbox" name="access[<?php echo $vo['id']; ?>]" <?php if($this->array_array['purviews'][$vo['id']]['access']=='1'){echo 'value="1" checked';}else{echo 'value="0"';} ?> onclick="access_click(this)"></td>
			<?php
				if($this->array_array['arr']['id'] != $this->array['not_log_in_user_group']){
			?>	
				<td height="30" style="line-height:30px;font-size:12px;color:#555;"><input type="checkbox" name="publish[<?php echo $vo['id']; ?>]" <?php if($this->array_array['purviews'][$vo['id']]['publish']=='1'){echo 'value="1" checked';}else{echo 'value="0"';} ?> onclick="if(this.checked){this.value='1';}else{this.value='0';}"></td>
				<td height="30" style="line-height:30px;font-size:12px;color:#555;"><input type="checkbox" name="reply[<?php echo $vo['id']; ?>]" <?php if($this->array_array['purviews'][$vo['id']]['reply']=='1'){echo 'value="1" checked';}else{echo 'value="0"';} ?> onclick="if(this.checked){this.value='1';}else{this.value='0';}"></td>
				<td height="30" style="line-height:30px;font-size:12px;color:#555;"><input type="checkbox" name="mark[<?php echo $vo['id']; ?>]" <?php if($this->array_array['purviews'][$vo['id']]['mark']=='1'){echo 'value="1" checked';}else{echo 'value="0"';} ?> onclick="if(this.checked){this.value='1';}else{this.value='0';}"></td>
			<?php	}else{	?>
				<td></td>
				<td></td>
				<td></td>
			<?php	}	?>
			</tr>
<?php
	}
}
?>
<tr>
	<td colspan="5">
		<input type="hidden" name="token" value="{token}">
		<input type="hidden" name="id" value="{arr->id}">
		<input type="image" src="{site}/Public/images/edit.gif"></td>
</tr>
	</table>
</form>
	<script>
		var zt=false;
		function selectAll()
		{
		 if(zt==true)
		  {zt=false;}
		 else
		 	{zt=true;}
		   var a = document.getElementsByTagName("input");
		   for (var i=0; i<a.length; i++) 
			  {
			    if (a[i].type == "checkbox"){
			    	a[i].checked = zt;
			    	if(zt){a[i].value = 1;}else{a[i].value = 0;}
			    }
			  }
			  loadcheckbox();
		}
		var tr=document.getElementsByTagName("tr");
		for(var n=0;n<tr.length;n++)
		{
			if(n==0||n==1) continue;
			if(n%2==0&&n!=0)
			{
				tr[n].className="tr0";	
			}else{
				tr[n].className="tr1";	
			}
		}
		function access_click(_this){
			var obj = _this.parentNode.parentNode.getElementsByTagName('input');
			if(_this.checked){
				_this.value='1';
				for(var i=0;i<obj.length;i++){
					obj[i].disabled=false;
				}
			}else{
				_this.value='0';
				for(var i=0;i<obj.length;i++){
					obj[i].checked=false;
					if(i!=0){
						obj[i].disabled=true;
					}
				}
			}
		}
		function loadcheckbox(){
			var access_arr = [];
			var input = document.getElementsByTagName("input");
			for(var i=0;i<input.length;i++){
		        if(/^access/.test(input[i].name)){
							access_arr.push(input[i]);
		        }
		    }
			for(var i=0;i<access_arr.length;i++){
				access_click(access_arr[i]);
			}
	  }
	  loadcheckbox();
	</script>
</body>
</html>